// WiFiManager.h
#pragma once
#include <WiFi.h>
#include "ConfigManager.h"

class WiFiManager {
private:
    ConfigManager& config;
    bool connected;
    unsigned long lastConnectAttempt;
    
public:
    WiFiManager(ConfigManager& cfg) : config(cfg), connected(false), lastConnectAttempt(0) {}
    
    bool begin();
    void update();
    bool connectToWiFi(const char* ssid, const char* password);
    bool startAP(const char* ssid, const char* password = nullptr);
    void disconnect();
    bool isConnected() { return connected; }
    String getStatus();
};